package com.lungle.warmdiary.app.api.remote;

import com.lungle.warmdiary.app.model.Result;
import com.lungle.warmdiary.app.model.request.ActiveCommentUpdatePost;
import com.lungle.warmdiary.app.model.request.ActiveExecuteUpdatePost;
import com.lungle.warmdiary.app.model.request.ActivePost;
import com.lungle.warmdiary.app.model.request.CampaignTestPost;
import com.lungle.warmdiary.app.model.request.FollowPost;
import com.lungle.warmdiary.app.model.request.MessagePost;
import com.lungle.warmdiary.app.model.request.PayAccountPost;
import com.lungle.warmdiary.app.model.request.PushPost;
import com.lungle.warmdiary.app.model.request.TesterApplyPost;
import com.lungle.warmdiary.app.model.request.WechatPost;
import com.lungle.warmdiary.app.model.request.WithdrawPost;
import com.lungle.warmdiary.app.model.response.Active;
import com.lungle.warmdiary.app.model.response.ActiveList;
import com.lungle.warmdiary.app.model.response.ActiveState;
import com.lungle.warmdiary.app.model.response.AddressPicker;
import com.lungle.warmdiary.app.model.response.AlipayAccount;
import com.lungle.warmdiary.app.model.response.AppSummary;
import com.lungle.warmdiary.app.model.response.CampaignCommentList;
import com.lungle.warmdiary.app.model.response.CampaignDetail;
import com.lungle.warmdiary.app.model.response.CampaignLink;
import com.lungle.warmdiary.app.model.response.CampaignList;
import com.lungle.warmdiary.app.model.response.CampaignMycomment;
import com.lungle.warmdiary.app.model.response.CampaignState;
import com.lungle.warmdiary.app.model.response.CommentList;
import com.lungle.warmdiary.app.model.response.InvestCode;
import com.lungle.warmdiary.app.model.response.MediaAccount;
import com.lungle.warmdiary.app.model.response.MessageList;
import com.lungle.warmdiary.app.model.response.Tag;
import com.lungle.warmdiary.app.model.response.TesterDetail;
import com.lungle.warmdiary.app.model.response.TesterIndustry;
import com.lungle.warmdiary.app.model.response.TesterStat;
import com.lungle.warmdiary.app.model.response.TradeRecoder;
import com.lungle.warmdiary.app.model.response.TradeRecordList;
import com.lungle.warmdiary.app.model.response.User;
import com.lungle.warmdiary.app.model.response.Wallet;
import com.lungle.warmdiary.app.model.response.WechatExist;
import com.lungle.warmdiary.app.model.response.WithdrawRecoder;
import com.lungle.warmdiary.app.model.response.WithdrawRecordList;

import java.util.ArrayList;
import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * @author sbbic
 *         created at 2016/9/7 9:48
 */
public interface UserApi {

    @POST("/mobile/register")
    Observable<Result> pushRegister(@Body PushPost post);

    @GET("/user/finance/info")
    Observable<Result<Wallet>> getWallet();


    @GET("/media/account/list")
    Observable<Result<List<MediaAccount>>> getMediaAccountList(@Query("platform") int platfrom);

    @GET("/media/weixin-account/validate-unionid")
    Observable<Result<WechatExist>> validateWid(@Query("unionid") String unionid);


    @POST("/media/weixin-account/create")
    Observable<Result> addWechatAccount(@Body WechatPost info);


    @POST("/media/weixin-account/update")
    Observable<Result> updateWechatAccount(@Query("id") String mediaid, @Body WechatPost post);


    @GET("/media/weixin-account/info")
    Observable<Result<MediaAccount>> getWechatAccountInfo(@Query("id") String id);


    @GET("/dict/industry")
    Observable<Result<List<Tag>>> getIndustryList();


    @GET("/dict/tags")
    Observable<Result<List<Tag>>> getTagList();

    @GET("/dict/locations")
    Observable<Result<ArrayList<AddressPicker.Province>>> getLocationList();

    @GET("/dict/tester-industry")
    Observable<Result<List<TesterIndustry>>> getTesterIndustryList();


    @POST("/media/advertiser/follow")
    Observable<Result> followAdviser(@Body FollowPost followPost);


    @GET("/media/campaign/list-all")
    Observable<Result<ActiveList>> getActiveList(@Query("mediaid") String mediaid, @Query("start") int start, @Query("length") int length);


    @GET("/media/campaign/detail")
    Observable<Result<Active>> getActiveDetail(@Query("id") String id, @Query("mediaid") String mediaid);


    @GET("/media/campaign/customer-review")
    Observable<Result<CommentList>> getActiveCommentList(@Query("groupid") String id, @Query("start") int start, @Query("length") int length);

    @POST("/media/campaign/participate")
    Observable<Result> attendActive(@Body ActivePost post);

    @POST("/media/campaign/refuse")
    Observable<Result> refuseActive(@Body ActivePost post);


    @POST("/media/campaign/publish")
    Observable<Result> updateActiveState(@Query("campaignid") String campaignid, @Query("mediaid") String mediaid, @Body ActiveExecuteUpdatePost post);

    @POST("/media/campaign/result")
    Observable<Result> updateActiveState(@Query("campaignid") String campaignid, @Query("mediaid") String mediaid, @Body ActiveCommentUpdatePost post);


    @GET("/user/profile/invitation")
    Observable<Result<InvestCode>> getInvitation();

    @GET("/media/campaign/stat")
    Observable<Result<ActiveState>> getMyActiveState();

    @GET("/media/campaign/list")
    Observable<Result<ActiveList>> getMyActiveList1(@Query("mediaid") String meidiaid, @Query("status") int state, @Query("start") int start, @Query("length") int length);


    @GET("/media/campaign/list")
    Observable<Result<ActiveList>> getMyActiveList(@Query("status") int state, @Query("start") int start, @Query("length") int length);

    @GET("/user/message/list")
    Observable<Result<MessageList>> getMessageList(@Query("start") int start, @Query("length") int length);

    @POST("/user/message/read")
    Observable<Result> updateMessageState(@Body MessagePost post);

    @GET("/user/pay-account/info")
    Observable<Result<AlipayAccount>> getAliPay();

    @POST("/user/pay-account/create")
    Observable<Result<AlipayAccount>> updateAlipayState(@Body PayAccountPost post);

    @GET("/user/pay-account/delete")
    Observable<Result> deleteAlipay(@Query("id") String id);


    @GET("/user/profile/info")
    Observable<Result<User>> getUserProfile();

    @GET("/user/finance/record")
    Observable<Result<TradeRecordList>> getTradeRecord(@Query("start") int start, @Query("length") int length, @Query("type") String type, @Query("month") String month);


    @GET("/user/finance/info")
    Call<ResponseBody> getFinanceInfo();

    @POST("/user/withdraw/create")
    Observable<Result> withdraw(@Body WithdrawPost info);


    @GET("/user/withdraw/list")
    Observable<Result<WithdrawRecordList>> getWithdrawList(@Query("start") int start, @Query("length") int length, @Query("status") int status);


    @GET("/user/withdraw/detail")
    Observable<Result<WithdrawRecoder>> getWithdrawDetail(@Query("id") String id);

    @GET("/user/withdraw/detail")
    Observable<Result<TradeRecoder>> getTradeDetail(@Query("id") String id);


    //test-campaign
    @GET("/media/test-campaign/list")
    Observable<Result<CampaignList>> getCampaignList(@Query("status") int state, @Query("start") int start, @Query("length") int length);


    @GET("/media/test-campaign/detail")
    Observable<Result<CampaignDetail>> getCampaignDetail(@Query("id") String id);

    @GET("/media/test-campaign/participate")
    Observable<Result<CampaignLink>> getCampaignLink(@Query("id") String id);


    @POST("/media/test-campaign/submit")
    Observable<Result> campaignSubmit(@Body CampaignTestPost info);

    @POST("/media/test-campaign/update")
    Observable<Result> campaignUpdate(@Body CampaignTestPost info);

    //todo intent传递
    @GET("/media/product-review/summary")
    Observable<Result<AppSummary>> getSummary(@Query("id") String id);


    @GET("/media/product-review/list")
    Observable<Result<CampaignCommentList>> getCampaignDetailList(@Query("id") String id, @Query("rate") int rate, @Query("start") int start, @Query("length") int length);


    @GET("/media/product-review/my")
    Observable<Result<CampaignMycomment>> getCampaignMy(@Query("productid") String productid, @Query("campaignid") String campaignid);

    @GET("/media/test-campaign/stat")
    Observable<Result<CampaignState>> getMyCampaignStat();

    @GET("/media/tester/stat")
    Observable<Result<List<TesterStat>>> getMyTesterStat();

    @POST("/media/tester/apply")
    Observable<Result> testerApply(@Body TesterApplyPost info, @Query("id") String applyId);

    @POST("/media/tester/apply")
    Observable<Result> testerApply(@Body TesterApplyPost info);

    @GET("/media/tester/detail")
    Observable<Result<TesterDetail>> getTesterApplyDetail(@Query("id") String applyId);
}

